/*
 * Ganesa Copyright (C) 2008 Wim Crols <twimpiex@gnx.be>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License Version 3
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

package be.gnx.ganesa.plugin.osm.ui.widget;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;

public class ImportTabItemControl extends be.gnx.ganesa.application.ui.widget.ImportTabItemControl {

  private boolean downloadGpxData = false;

  private Button gpxButton;

  public ImportTabItemControl(Composite parent, int style) {
    super(parent, style);

    gpxButton = new Button(this, SWT.CHECK);
    gpxButton.setText("download gpx data as well");
    gpxButton.setSelection(downloadGpxData);
    resize();

    gpxButton.addMouseListener(new MouseListener() {
      public void mouseDown(MouseEvent mouseEvent) {
        mouseUp(mouseEvent);
      }

      public void mouseDoubleClick(MouseEvent mouseEvent) {
        mouseUp(mouseEvent);
      }

      public void mouseUp(MouseEvent mouseEvent) {
        downloadGpxData = ((Button) (mouseEvent.widget)).getSelection();
      }
    });
  }

  public void dispose() {
    return;
  }

  public void resize() {
    gpxButton.setBounds(30, 30, gpxButton.getParent().getClientArea().width - 60, gpxButton.getParent().getClientArea().height - 60);
  }

  public boolean isDownloadGpxData() {
    return downloadGpxData;
  }

}